package view;

import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JLabel;

import model.Player;
import utility.Update;

public class PlayerRep extends JLabel implements Update{

	private Player player;
	public static final int WIDTH = 30;
	public static final int HEIGHT = 30;
	
	public PlayerRep(Player player){
		this.player = player;
		Dimension d = new Dimension(WIDTH,HEIGHT);
		setSize(d);
		setPreferredSize(d);
	}

	public void update() {
		setLocation(player.x, player.y);
	}
	
	protected void paintComponent(Graphics g){
		player.getIcon().paintIcon(this, g, 0, 0);
	}
	
}
